package cn.com.java.mapper;

import cn.com.java.model.Product;
import cn.com.java.model.ShoppingCart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartMapper extends BaseMapper<ShoppingCart> {


    @Select("SELECT s.*,p.name as productName,p.price as price FROM shopping_cart s left join product p on p.id = s.product_id  WHERE s.create_by = #{userId}")
    List<ShoppingCart> selectByUserId(Long userId);
}